<%-- 
    Document   : changepass
    Created on : Nov 28, 2013, 8:11:34 PM
    Author     : Welcome
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link rel="stylesheet" href="css/bocuc.css" type="text/css"/>
        <link rel="stylesheet" href="css/style.css" type="text/css"/>

        <link rel="stylesheet" href="css/testcss.css" type="text/css"/>
        <link rel="stylesheet" href="css/mystyle.css" type="text/css"/>
        <link rel="stylesheet" href="css/botoncss.css" type="text/css"/>
        <script type="text/javascript" src="jquery/jquery-1.1.3.1.min.js"></script> 
        <script type="text/javascript" src="jquery/jquery-1.4.2.js"></script> 
        <script type="text/javascript" src="jquery/jquery-latest.js"></script>
        <script type="text/javascript" src="jquery/myjquery.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        

        <title> Thay đổi mật khẩu</title>
         <script type="text/javascript" src="jquery/jquery-1.8.0.min.js"></script>

      
          <script type="text/javascript" >
              
            $(function() {
                $(".inputsearch").keyup(function()
                {
                    var searchid = $(this).val();
                    var dataString = 'search=' + searchid;
                    if (searchid !== '')
                    {
                        $.ajax({
                            type: "POST",
                            url: "searchAjax.jsp",
                            data: dataString,
                            cache: false,
                            success: function(html)
                            {
                                $("#showhint").html(html).show();
                            }
                        });
                    }else{
                         jQuery("#showhint").hide();
                    }
                    return false;
                });

                jQuery("#showhint").live("click", function(e) {
                    var $clicked = $(e.target);
                    var $name = $clicked.find('.name').html();
                    var decoded = $("<div/>").html($name).text();
                    $('#searchid').val(decoded);
                });
                jQuery(document).live("click", function(e) {
                    var $clicked = $(e.target);
                    if (!$clicked.hasClass("inputsearch")) {
                        jQuery("#showhint").fadeOut();
                    }
                });
                $('#searchid').click(function() {
                    jQuery("#showhint").fadeIn();
                });
                
            });
        </script>
        <style type="text/css">
         //body{ 
         //       font-family:Tahoma, Geneva, sans-serif;
         //       font-size:18px;
         //   }
        //    .content{
        //        width:900px;
        //        margin:0 auto;
        //    }
            .name{
                width:446px;
                
                margin-top:-1px !important;
                background-color:transparent !important;
                margin-left:0;}
            #showhint
            {
                position:absolute;
                width:446px;
                padding:10px;
                display:none;
                margin-top:-1px;
                border-top:0px;
                overflow:hidden;
                border:1px #CCC solid;
                background-color: white;
                margin-left: 423px;
            }
            .show
            {
                padding:10px; 
                border-bottom:1px #999 dashed;
                font-size:15px; 
                height:50px;
            }
            .show:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
            .name:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
        </style>
        <script>
            var xmlhttp;
            function check()
            {
                xmlhttp = GetXmlHttpObject();

                if (xmlhttp == null)
                {
                    alert("Your browser does not support Ajax HTTP");
                    return;
                }
                    var pass = document.getElementById("txtOldPass").value;
                    var url = "checkpass.jsp";
                    url = url + "?pass=" + pass;

                    xmlhttp.onreadystatechange = getOutput;
                    xmlhttp.open("GET", url, true);
                    xmlhttp.send(null);
            }
             function getOutput()
            {
                if (xmlhttp.readyState == 4 || xmlHttp.readyState == "complete")
                {
                    document.getElementById("pass").innerHTML = xmlhttp.responseText;
                }
            }
            function GetXmlHttpObject()
            {
                if (window.XMLHttpRequest)
                {
                    return new XMLHttpRequest();
                }
                if (window.ActiveXObject)
                {
                    return new ActiveXObject("Microsoft.XMLHTTP");
                }
                return null;
            }
            function check_pass()
            {
                var pass = document.getElementById("txtPassword").value;
                var passc = document.getElementById("txtChkPassword").value;

                if (pass.trim() === "") {
                    document.getElementById("ck_pass").innerHTML = "<p style='color:red'>Mật khẩu không được bỏ trống!</p>";
                }
                else {
                    document.getElementById("ck_pass").innerHTML = "<p style='color:green'>Mật khẩu hợp lệ!</p>";
                }
                if (pass != passc)
                {
                    document.getElementById("idcheck_pass").innerHTML = "<p style='color:red'>Mật khẩu phải giống nhau</p>";
                    document.getElementById("txtChkPassword").value = "";
                }
                else if (passc.trim() === "") {
                    document.getElementById("idcheck_pass").innerHTML = "<p style='color:red'>Bạn phải nhập lại mật khẩu!</p>";
                    document.getElementById("txtChkPassword").value = "";
                }
                else {
                    document.getElementById("idcheck_pass").innerHTML = "<p style='color:green'>Mật khẩu hợp lệ!</p>";
                }
            }
        </script>
    </head>
    <body>
        <div class="bodypage">
            <!phan dau cua trang>
            <div class="top">
                <%@include file='header.jsp'%>
            </div>
            <!phan search>
            <div class="khoangcachtrang">
                <div class="searchgroup">

                    <%@include file='search.jsp' %> 
                    <div class="chontimkiem">
                        <a href="timkiemnangcao.jsp">Tìm Kiếm Nâng Cao</a>
                    </div>

                </div>
            </div>

            <!phan giua trang >
            <div class="centerpage">

                <div class="leftsite">
                    <div class="menuweb">
                        <%@include file='menuleft.jsp' %>
                    </div>
                </div>

                <div class="content">
                    <div class="khoangtrang"></div>
                    <h1>Thay đổi mật khẩu!</h1>
                    <form  class="thaymatkhau" action="RegisterController" method="post" id="formChange">
                        <input name="txtOldPass" id="txtOldPass" type="password" placeholder="Nhập mật khẩu cũ" onBlur="check();"/>
                        <div id="pass"></div>
                        <br>
                        <input name="txtNewPass" id="txtPassword" type="password" placeholder="Nhập mật khẩu mới"/>
                        <div id="ck_pass"></div><br>
                         <input name="txtOldPass" id="txtChkPassword"type="password" placeholder="Nhập lại mật khẩu mới" onBlur="check_pass();"/>
                         <div id="idcheck_pass"></div> <br>
                        <input value="ChangePass" name="action" type="submit"/>
                        <input value="Cancel" type="submit" id="closeChange" name="action"/>
                    </form>
                    <div class="khoangtrang"></div>
                </div>
                    

            </div>
            <!phan cuoi trang>
            <div class="footer">
                <div class="footerleft"></div>
                <div class="footerright"></div>
            </div>
        </div>

    </body>
</html>
